Fantasy Role Playing Dice

Many fantasy role playing (FRP) systems require the players to cast dice of varying types during the execution of the game. This recipe permits a player to select the number and sides of dice to be played.

Number of Dice:

Sides of Dice



Discussion

Netscape needs to know the correct path to load these graphic images. The getSibling function recovers the parent's path from the document location and adds directions to a sibling or nephew folder. It strips off the document name and then the current directory.
// Get the grandparent directory and append aDir
function getSibling(aDir)
{
    var loc = ""+document.location
    
    // get this dir, then parent
    var base = loc.substring(0, loc.lastIndexOf("/"))
    base = base.substring(0, base.lastIndexOf("/")+1)
    return base+aDir+'/'
}

Copyright ©2000 by Charles River Media, All Rights Reserved